<template>
    <div>
        <form-user @signup="login"/>
    </div>
</template>
<script>
import { mapState, mapActions } from 'vuex'
import formUser from './form-user'
export default {
    name: 'login',
    data() {
        return {
            msg: null
        }
    },
    methods: {
        ...mapActions('user', ['login', 'register']),
        login(values){
            this.login(values)
            .then(()=>{
                console.log('请求成')
            })
            if (this.token) {
                this.msg = '登陆成功'
            } else{
                this.msg = '登陆失败'
            }
            this.$toast(this.msg)
        }
    },
    computed: {
        ...mapState('user', ['token'])
    },
    components:{
        formUser // 表单组件
    },
    mounted() {
        this.$store.commit('hide') // 隐藏底部tabbar
    },
    destroyed() {
        this.$store.commit('show') // 显示底部tabbar
    }
}
</script>
<style lang="scss" scoped>

</style>
